/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package stuff;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author JArik
 */
public class DrugPriceRenderer extends JComboBox 
            implements TableCellRenderer{
private ArrayList<ArrayList> prices;
     public DrugPriceRenderer(ArrayList pric) {
        super();
        this.setEditable(true);
        prices = pric;
        this.addMouseListener(new MouseAdapter()
        {
            public void mouseMoved(MouseEvent e)
            {
                
            }
        });
        
     }
     public void setSelected(Object toSel, int row)
     {
         this.getEditor().setItem(toSel.toString());
         
     }
     

     public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column) {

         if (isSelected) {
           setForeground(table.getSelectionForeground());
           super.setBackground(table.getSelectionBackground());
           
         } else {
           setForeground(table.getForeground());
           setBackground(table.getBackground());
         }
         
         this.getEditor().setItem(value);
         return this;
      }
     
}
